# 1
# money = float(input("请输入存入金额："))
# target_money = float(input("请输入目标金额："))
# i = 0
# while True:
#     i += 1
#     sum = money * 1.05 ** i
#     sum2 = "%.2f" % sum
#     if sum >= target_money:
#         print(f"第{i}年账户余额为{sum2}元")
#         print(f"需要{i}年,本金+利息>=目标金额")
#         break
#     else:
#         print(f"第{i}年账户余额为{sum2}元")

# 2
# while True:
#     value = (input("请输入pm2.5的值："))
#     if value.isdigit():
#         value = int(value)
#         if 0 <= value <= 50:
#             print("空气质量：优")
#         elif 51 <= value <= 100:
#             print("空气质量：良")
#         elif 101 <= value <= 150:
#             print("空气质量：轻度污染")
#         elif 151 <= value <= 200:
#             print("空气质量：中度污染")
#         elif 201 <= value <= 300:
#             print("空气质量：重度污染")
#         elif value > 300:
#             print("空气质量：严重污染")
#     elif value == "Q":
#         print("退出！")
#         break

# 3
import random
i = 1
golden_beans = 1000
while True:
    if golden_beans < 100:
        print("余额不足，退出游戏！")
        break
    num1 = random.randint(1,6)
    num2 = random.randint(1,6)
    num3 = random.randint(1,6)
    sum = num1 + num2 + num3
    # if golden_beans < 100:
    #     print("余额不足，退出游戏！")
    #     break
    print(f"第{i}次猜想:")
    guess = input("请输入您的猜想（大/小）：")
    if guess != "exit":
        # if guess != "大" and guess != "小":
        if guess not in ["大","小"]:
            print("格式不正确，请重新输入：")
            continue
        i += 1
        if 3 <= sum <= 10:
            result = "小"
        else:
            result = "大"
        if guess == result:
            golden_beans += 100
            print(f"恭喜猜对了，点数为{sum}，金豆剩余：{golden_beans}")
        else:
            golden_beans -= 100
            print(f"抱歉猜错了，点数为{sum}，金豆剩余：{golden_beans}")
    else:
        print(f"游戏结束，总共玩了{i-1}次")
        break

# 4
# while True:
#     grade = input("请输入成绩(0-100)：")
#     if grade.isdigit():
#         pass
#     else:
#         print("您输入的不是纯数字！")
#         continue
#     grade = int(grade)
#     if grade > 100 or grade < 0:
#         print("您输入的范围不是0-100")
#         continue
#     else:
#         pass
#     if 85 <= grade <= 100:
#         print("优秀")
#     elif 60 <= grade <85:
#         print("良好")
#     else:
#         print("不及格")
#     break
<<<<<<< HEAD
=======

>>>>>>> 4113d8634b9906da7dc1febbbdc4565e7063d33e
